package com.suny.sf_server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.suny.FarmStocks.domain.FarmStocks;
import com.suny.FarmStocks.vo.FarmStocksVO;
import com.suny.FarmStocks.dto.FarmStocksQueryDTO;

import java.util.List;

/**
* @author sun
* @description 针对表【farm_stocks(存栏信息表)】的数据库操作Mapper
* @createDate 2024-12-27 10:45:10
* @Entity domain.FarmStocks.suny.com.FarmStocks
*/
@Mapper
public interface FarmStocksMapper extends BaseMapper<FarmStocks> {
    
    /**
     * 获取指定牧场的存栏信息
     */
    List<FarmStocksVO> selectByFarmId(@Param("farmId") Integer farmId);
    
    /**
     * 统计牧场未出栏数量
     */
    Integer countFarmLivestock(@Param("farmId") Integer farmId);
    
    /**
     * 统计圈舍未出栏数量
     */
    Integer countPenLivestock(@Param("penId") Integer penId);
    
    /**
     * 统计围栏未出栏数量
     */
    Integer countFenceLivestock(@Param("fenceId") Integer fenceId);
    
    /**
     * 分页查询存栏列表
     */
    IPage<FarmStocksVO> selectFarmStocksVOPage(IPage<FarmStocks> page);
    
    /**
     * 条件查询存栏列表
     */
    IPage<FarmStocksVO> selectFarmStocksVOPageByCondition(
        @Param("page") IPage<FarmStocks> page,
        @Param("query") FarmStocksQueryDTO query
    );
}




